package com.example.demo.colltroller;

import com.example.demo.pojo.vo.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.prefs.BackingStoreException;

@RestControllerAdvice
public class ProjectExceptionAdvice {

    @ExceptionHandler(BackingStoreException.class)
    public Result doBusinessException(BackingStoreException ex){

        String message = ex.getMessage();
        return new Result(false,message);

    }

    @ExceptionHandler(Exception.class)
    public Result doException(Exception ex){
        ex.printStackTrace();

        return new Result(false,"系统炸了!请等待修复");
    }


}
